import { type KeyofLocale } from '@/utils/locales'

export const systemSettings = defineStore('systemSettings', () => {
  // const locale = localeGetter()

  const currentLocale = useStorage<KeyofLocale>('locale', 'en-US')

  // 当前语言显示
  // const currentLang = computed(() => (currentLocale.value === 'zh-CN' ? '简体中文' : 'English'))

  // 切换语言
  const handleLanguageChange = (lang: KeyofLocale) => {
    // locale.value = lang
    setLocale(lang)
    // 可选：将语言选择保存到 localStorage
    currentLocale.value = lang
  }

  return { currentLocale, handleLanguageChange }
})
